import { useNavigatePage } from '@/hooks/navigateTo'
import useToastMsg from '@/hooks/sysMsg'
import useUserInfoStore from '@/store/userInfo'

export const LoginStatusCheck = (cabllback: any, modelCallback?: any) => {
  const userInfoStore = useUserInfoStore()
  const toastMsg = useToastMsg()
  const navigatePage = useNavigatePage()
  if (userInfoStore.getUserInfo.userId) {
    cabllback && cabllback()
  } else {
    toastMsg.showModalMsg({
      title: '当前账户未登录',
      content: '',
      options: {
        showCancel:false,
        confirmText: '去登录',
        confirmColor: '#6aa8ff',
      },
      successCallback: async () => {
        navigatePage.navigateTo('/pages/login/index')
        modelCallback && modelCallback()
      },
      // cancelCallback: async () => modelCallback && modelCallback(),
    })
  }
}
